<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8" isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<%
	request.setAttribute("accessPath", request.getContextPath());
%>
<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>正常点到</title>
	<link href="${ requestScope['accessPath']}/css/alerts/jquery.alerts.css" rel="stylesheet">

    <!-- Bootstrap Core CSS -->
    <link href="${ requestScope['accessPath']}/fontcss/bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">

    <!-- MetisMenu CSS -->
    <link href="${ requestScope['accessPath']}/fontcss/bower_components/metisMenu/dist/metisMenu.min.css" rel="stylesheet">

    <!-- DataTables CSS -->
    <link href="${ requestScope['accessPath']}/fontcss/bower_components/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.css" rel="stylesheet">

    <!-- DataTables Responsive CSS -->
    <%-- <link href="${ requestScope['accessPath']}/fontcss/bower_components/datatables-responsive/css/dataTables.responsive.css" rel="stylesheet"> --%>

    <!-- Custom CSS -->
    <link href="${ requestScope['accessPath']}/fontcss/dist/css/sb-admin-2.css" rel="stylesheet">

    <!-- Custom Fonts -->
    <link href="${ requestScope['accessPath']}/fontcss/bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">

	<link href="${ requestScope['accessPath']}/fontcss/css/jquery-labelauty.css" rel="stylesheet">
	
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
<style type="text/css">
	#page-wrapper {
		margin: 0 0 0 0px;
	}
	ul {
	list-style-type: none;
		margin: 0px 0;
	}
	
	ul {
		margin: 0;
	}
	
	li {
		display: inline-block;
	}
	
	li {
		margin: 0;
	}
</style>

<script type="text/javascript">
	var params = 'courseId=${classCourse.id}&section=${classCourse.hzClassDaycourse.startSection }-${classCourse.hzClassDaycourse.endSection}&teacherId=${classCourse.hzTeacher.id}&dayCourseId=${classCourse.hzClassDaycourse.id}';
	var accessUrl = "/check/changeCheckstudentAttend";
</script>
</head>

<body>

    <div id="wrapper">

        <div id="page-wrapper">
            <div class="row">
                <div class="col-lg-12">
                    <h1 class="page-header"> 
						${classCourse.hzSemester.years}学年第二学期第${classCourse.currentWeekNo}周 课程节次：${classCourse.hzClassDaycourse.startSection }-${classCourse.hzClassDaycourse.endSection}</h1>
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
            <div class="row" id="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                           当前班级：${classCourse.hzClasses.className } ，
                           课程名：${classCourse.course }，
                           教师名称：${classCourse.hzTeacher.name }
                          
                        </div>
                        <!-- /.panel-heading -->
                        <div class="panel-body">
                            <div class="dataTable_wrapper">
                                <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                                    <thead>
                                        <tr>
                                            <th>序号</th>
                                            <th>学号</th>
                                            <th>姓名</th>
                                            <th>签到状态</th>
                                            <!-- <th>定制班</th>
                                            <th>出勤</th>
                                            <th>迟到</th>
                                            <th>请假</th>
                                            <th>旷课</th> -->
                                        </tr>
                                    </thead>
                                    <tbody>
                                    	<c:forEach var="student" items="${studentList }" varStatus="status">
                                    		<tr class="odd gradeX">
                                            <td>${status.index + 1}</td>
                                            <td>${student.sno}</td>
                                            <td>${student.name}</td>
                                            <td class="center">
                                            	<ul class="dowebok">
                                            		<c:if test="${student.special == 0}">
                                            			<li><fieldset disabled="">
                                            		</c:if>
															<li><input type="radio" name="${student.sno}" 
															 <c:if test="${student.special == 1}" >checked="true" </c:if> 
															value="-1" data-labelauty="定制班"></li>&nbsp;
													<c:if test="${student.special == 0}">	
														</fieldset></li>
                                            		</c:if>
                                            		<c:if test="${student.special == 1}">
                                            			<li><fieldset disabled="">
                                            		</c:if>
													<li><input type="radio" name="${student.sno}" 
														<c:if test="${student.special == 0 && student.checkinsState == 0}" >checked="true" </c:if>
													 value="0" data-labelauty="出勤" ></li>&nbsp;
													<li><input type="radio" name="${student.sno}" <c:if test="${student.special == 0 && student.checkinsState == 1}" >checked="true" </c:if> value="1" data-labelauty="迟到"></li>&nbsp;
													<li><input type="radio" name="${student.sno}" <c:if test="${student.special == 0 && student.checkinsState == 3}" >checked="true" </c:if> value="3" data-labelauty="请假"></li>&nbsp;
													<li><input type="radio" name="${student.sno}" <c:if test="${student.special == 0 && student.checkinsState == 2}" >checked="true" </c:if>value="2" data-labelauty="旷课"></li>
													<c:if test="${student.special == 1}">	
														</fieldset></li>
                                            		</c:if>
												</ul>
                                            </td>
	                                        </tr>
                                    	 </c:forEach>
                                    </tbody>
                                </table>
                            </div>
                            <div class="panel-body" style="text-align:center;">
								<a class="btn btn-default btn-lg 
								submit-button" href="#">提交</a>                            	
                            </div>
                            <div class="alert alert-success alert-dismissable" style="display:none;">
                                <button type="button" class="close" >×</button>
                                <span>温馨提示:</span>
                                <span></span>
                            </div>
							<div class="alert alert-danger alert-dismissable" style="display:none;">
								<button type="button" class="close" >×</button>
								<span>错误提示:</span>
								<span></span>
							</div>
                            <div class="alert alert-info">
                            	<span id="Timer"></span>
                                <p>课上点到记录到${editTime}为止都能修改哟！</p>
                            </div>
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
           
        </div>
        <!-- /#page-wrapper -->
		
    </div>
    <!-- /#wrapper -->
    <!-- jQuery -->
    <script src="${ requestScope['accessPath']}/fontcss/bower_components/jquery/dist/jquery.min.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="${ requestScope['accessPath']}/fontcss/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>

    <!-- Metis Menu Plugin JavaScript -->
    <script src="${ requestScope['accessPath']}/fontcss/bower_components/metisMenu/dist/metisMenu.min.js"></script>

    <!-- DataTables JavaScript -->
    <script src="${ requestScope['accessPath']}/fontcss/bower_components/datatables/media/js/jquery.dataTables.min.js"></script>
    <script src="${ requestScope['accessPath']}/fontcss/bower_components/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.min.js"></script>

    <!-- Custom Theme JavaScript -->
    <script src="${ requestScope['accessPath']}/fontcss/dist/js/sb-admin-2.js"></script>

	<script src="${ requestScope['accessPath']}/fontcss/js/jquery-labelauty.js"></script>
    <!-- Page-Level Demo Scripts - Tables - Use for reference -->
    
    <!-- 自定义JS -->
    <script src="${ requestScope['accessPath']}/js/common/common.js"></script>
    <script src="${ requestScope['accessPath']}/js/check/check.js" ></script>
    <script src="${ requestScope['accessPath']}/js/showTime/showTime.js"></script>
    <script src="${ requestScope['accessPath']}/js/alerts/jquery.alerts.js"></script>
    <script>
    $(document).ready(function() {
        $('#dataTables-example').DataTable({
        	"language": {
    	        
	        	  "sProcessing": "处理中...",
	        	        "sLengthMenu": "显示 _MENU_ 项结果",
	        	        "sZeroRecords": "没有匹配结果",
	        	        "sInfo": "显示第 _START_ 至 _END_ 项结果，共 _TOTAL_ 项",
	        	        "sInfoEmpty": "显示第 0 至 0 项结果，共 0 项",
	        	        "sInfoFiltered": "(由 _MAX_ 项结果过滤)",
	        	        "sInfoPostFix": "",
	        	        "sSearch": "搜索关键字:",
	        	        "sUrl": "",
	        	        "sEmptyTable": "表中数据为空",
	        	        "sLoadingRecords": "载入中...",
	        	        "sInfoThousands": ",",
	        	        "oPaginate": {
	        	            "sFirst": "首页",
	        	            "sPrevious": "上页",
	        	            "sNext": "下页",
	        	            "sLast": "末页"
	        	        },
	        	        "oAria": {
	        	            "sSortAscending": ": 以升序排列此列",
	        	            "sSortDescending": ": 以降序排列此列"
	        	        }
	    },
	    "lengthChange": true,
	    "paging": true,
	    "info": true
        });
        setInterval("GetTime('Timer')", 1000); 
    });
	$(function(){
		$(':radio').labelauty();
	});
	
	$(":radio").click(function(){
		var t = this;
		jPrompt('', '请一定要填写修改原因哟', '为什么修改呢^-^', function(r) {
			$(t).attr("data-cause", r);
			if (!r) {
				var dataValue = $(t).attr("data-value");
				$("input[name="+ t.name +"]").get(dataValue).checked = true;
			}
		});
	});
	
	
	$(".submit-button").click(function() {
		jConfirm('你确认这么做吗？', '确认对话框', function(r) {
		if( r ) {
			var radios = $(":checked");
			var control = $(".form-control");
		
			if (radios) {
				// 循环
				var interim = "" ;
				$.each(radios, function(n, v) {
					if (v.name && v.value && v.value != -1) {
						if ($(v).attr("data-cause")) {
							interim += v.name + '-' + v.value + '-' + $(v).attr("data-cause") + ",";
						}
					}
				});
				if (interim) {
					params += "&students=" + interim;
					accessMethod(WEB_URL_PREFIX + accessUrl, params, 'POST', 'json');
				}
			} 
		}
		});
	});
    </script>
</body>

</html>
